package com.zhuzi.demo.entity;

import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;

@MappedSuperclass//这个注解的意思是这个类jpa不会为它创建数据库表，
//jpa会将这个类的所有字段映射到它的子类的数据库表中
@Data
@Accessors(chain = true)
public abstract class BaseEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GenericGenerator(name = "my_id", strategy = "com.zhuzi.demo.config.MyIdGenerator")
	@GeneratedValue(generator = "my_id")
	private Long id;
}
